package com.panopset.op;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * System.in prompter.
 *
 * @author Karl Dinwiddie
 *
 */
public final class PrompterConsole extends Prompter {

    /**
     * @param args
     *            Not used
     */
    public static void main(final String... args) {
        System.out.println(new PrompterConsole("testing: ").get());
    }

    /**
     * @param prompt
     *            User prompt.
     */
    public PrompterConsole(final String prompt) {
        super(prompt);
    }

    @Override
    public String get() {
        System.out.println(getPrompt());
        BufferedReader br = new BufferedReader(

        new InputStreamReader(System.in));
        try {
            String rslt = br.readLine();
            br.close();
            System.in.close();
            return rslt;
        } catch (IOException e) {
            return e.getMessage();
        }
    }

}
